package com.zhangyusheng.easyecharts.component;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * TODO: ECharts 中的 tooltip（提示框组件）的主要用途是：当用户鼠标悬停在图表的图形元素（如折线图的点、柱状图的柱子、饼图的扇形等）上时，以悬浮框的形式展示该数据点的详细信息。
 *
 * @author Michael zhang
 * @email zhangys_0217@sina.com
 * @since 2025年11月04日
 */
@Data
@Accessors(chain = true)
public class Tooltip implements Serializable {
    private final static long serialVersionUID = 2L;
    private String trigger;
    private AxisPointer axisPointer;
    /**
     * 推荐官方的模板语法
     */
    private String formatter;

    public static class Builder{
        private String trigger;
        private AxisPointer axisPointer;
        private String formatter;

        public Builder trigger(String trigger){
            this.trigger = trigger;
            return this;
        }
        public Builder axisPointer(AxisPointer axisPointer){
            this.axisPointer = axisPointer;
            return this;
        }
        public Builder formatter(String formatter){
            this.formatter = formatter;
            return this;
        }
       public Tooltip build(){
            return new Tooltip(this);
       }

    }
    private Tooltip(Builder builder){
        this.trigger = builder.trigger;
        this.axisPointer = builder.axisPointer;
        this.formatter = builder.formatter;
    }
}